﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace RapidSalesAdminPortalAPI.DataAccess
{
    public partial class RS_LogPortalContext : DbContext
    {
        public RS_LogPortalContext()
        {
        }

        public RS_LogPortalContext(DbContextOptions<RS_LogPortalContext> options)
            : base(options)
        {
        }

        public virtual DbSet<FrIpSystemLog> FrIpSystemLogs { get; set; } = null!;

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("Data Source=143.64.228.41;uid=SSIS;pwd=1236;Initial Catalog=RS_LogPortal");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<FrIpSystemLog>(entity =>
            {
                entity.ToTable("FR_IP_SystemLog");

                entity.Property(e => e.Id).ValueGeneratedNever();

                entity.Property(e => e.ClientHostIp)
                    .HasMaxLength(100)
                    .IsUnicode(false)
                    .HasColumnName("ClientHostIP");

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.FunctionModuleId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .HasColumnName("FunctionModuleID");

                entity.Property(e => e.LogTypeId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .HasColumnName("LogTypeID");

                entity.Property(e => e.PlatformLoginName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ResponseCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SessionId)
                    .HasMaxLength(100)
                    .IsUnicode(false)
                    .HasColumnName("SessionID");

                entity.Property(e => e.SubFunctionModuleId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .HasColumnName("SubFunctionModuleID");

                entity.Property(e => e.Timestamp).HasColumnType("datetime");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
